package com.app.mapper;

import com.app.model.ComplaintModel;
import com.app.model.UserModel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ComplaintMapper extends BaseMapper<ComplaintModel> {
    List<ComplaintModel> selectComplaintList(Integer page, Integer limit, String keyword, String startTime, String endTime, Integer adminId, Integer roles, Integer clue, Integer status, Integer examine, Integer warningStatus);

    //统计黄灯和红灯数量
    @Select("select count(warning_status) from lm_complaint where warning_status=2 or warning_status=3 and  FIND_IN_SET(#{adminId}, admin_user_id)")
    Integer selectNoGreenLightCount(Integer adminId);

    //查询黄灯和红灯数据
    @Select("select * from lm_complaint where warning_status=2 or warning_status=3 ORDER BY id DESC limit #{page},#{limit}")
    List<ComplaintModel> selectNoGreenLightList(@Param("page") Integer page, @Param("limit") Integer limit);

    int selectComplaintCount(String keyword, String startTime, String endTime, Integer adminId, Integer roles, Integer clue, Integer status, Integer examine, Integer warningStatus);

    List<UserModel> whiteList();

    int selectAllCount(Integer id);

    int selectStatusCount(Integer id);

    int selectByType(Integer type, Integer adminId, Integer roles);

    int selectByStatus(Integer status, Integer adminId, Integer roles);

    int selectIndustryCount(Integer id, Integer adminId, Integer roles);

    List<ComplaintModel> getComplaintList(Integer page, Integer limit, String keyword, String startTime, String endTime, String isJiuquan, Integer clue, Integer status, Integer examine, Integer warningStatus);

    int getComplaintCount(String keyword, String startTime, String endTime, String isJiuquan, Integer clue, Integer status, Integer examine, Integer warningStatus);

}
